From: Jim Blandy Date: Fri, 28 May 1993 08:48:33 +0000 (+0000) Subject: * keyboard.c (menu_bar_items): Bind Qinhibit_quit to Qt while we X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~95851 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=db60d856e8de8cbfa2e34cfaf301df7a7b0b6c59;p=emacs.git * keyboard.c (menu_bar_items): Bind Qinhibit_quit to Qt while we call the keymap accessors; this gets called during redisplay. --- diff --git a/src/keyboard.c b/src/keyboard.c index f1b577ed70f..97527896704 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3059,6 +3059,8 @@ static Lisp_Object menu_bar_one_keymap (); Lisp_Object menu_bar_items () { + int count = specpdl_ptr - specpdl; + /* The number of keymaps we're scanning right now, and the number of keymaps we have allocated space for. */ int nmaps; @@ -3073,6 +3075,12 @@ menu_bar_items () int mapno; + /* In order to build the menus, we need to call the keymap + accessors. They all call QUIT. But this function is called + during redisplay, during which a quit is fatal. So inhibit + quitting while building the menus. */ + specbind (Qinhibit_quit, Qt); + /* Build our list of keymaps. If we recognize a function key and replace its escape sequence in keybuf with its symbol, or if the sequence starts with a mouse @@ -3108,7 +3116,7 @@ menu_bar_items () result = menu_bar_one_keymap (def, result); } - return Fnreverse (result); + return unbind_to (count, Fnreverse (result)); } /* Scan one map KEYMAP, accumulating any menu items it defines